//
//  NYInstituteView.m
//  NiuWaJiaoYu
//
//  Created by MinLison on 2018/1/6.
//  Copyright © 2018年 niuwaketang. All rights reserved.
//

#import "NYInstituteView.h"

@interface NYInstituteView ()

@end
@implementation NYInstituteView

- (void)setPageViewController:(NYPageViewController *)pageViewController {
    
    if (!pageViewController) {
        return;
    }
    _pageViewController = pageViewController;
    [self addSubview:pageViewController.view];
    BOOL showComment = [self.controller alwaysShowCommentView];
    [pageViewController.view mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        if (@available(iOS 11.0,*))
        {
            if (showComment)
            {
                make.bottom.equalTo(self.controller.commentToolBar.mas_safeAreaLayoutGuideTop);
            }
            else
            {
                make.bottom.equalTo(self.mas_safeAreaLayoutGuideBottom);
            }
            make.top.equalTo(self.mas_safeAreaLayoutGuideTop);
            make.left.equalTo(self.mas_safeAreaLayoutGuideLeft);
            make.right.equalTo(self.mas_safeAreaLayoutGuideRight);
        }
        else
        {
            if (showComment)
            {
                make.bottom.equalTo(self.controller.commentToolBar.mas_top);
            }
            else
            {
                make.bottom.equalTo(self.controller.mas_bottomLayoutGuideTop);
            }
            make.top.equalTo(self.controller.mas_topLayoutGuideBottom);
            make.left.right.equalTo(self);
        }
    }];

}

@end
